/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 2 -*- */
/**
* @file TestDebug.c
* 
* Function for testing the debug library class code.
* 
* @author Miguel Ángel Vílchez López 2010 <sacra@openmatica.es>
*
* Codigo is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* 
* Codigo is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License along
* with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <debug.cpp>

/**
* @example TestDebug.c
*/

int main()
{
	int fp;
	
	//Show error without logging
	CMDebug logeo1(false);
	if ( (fp=open("coke",O_RDONLY)) < 0)
	{	logeo1.error(strerror(errno),__FILE__,__FUNCTION__,(__LINE__)); }
	
	//Show and write log
	CMDebug logeo2(false,"prueba");
	if ( (fp=open("coke",O_RDONLY)) < 0)
	{	logeo2.error(strerror(errno),__FILE__,__FUNCTION__,(__LINE__)); }

	//Not showing debug and not write log
	CMDebug logeo3(false);
	logeo3.debug("Trying to show a debug information .. false");

	//Show debug information whitout logging
	CMDebug logeo4(true);
	logeo4.debug("Trying to show a debug information .. true");

	//Show debug and write to log
	CMDebug logeo5(true,"prueba");
	logeo5.debug("Trying to show a debug information .. true and log");

	close(fp);
	
}
